const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: `201900${i}`,
        name: `JXSMC00${i}`,
        branchCode: 'chery',
        status: 1,
        rowVersion: 'string',
        options: [
            'abandon',
            'update'
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'string',
        payload: {
            id: '1',
            code: '2019001',
            name: 'JXSMC001',
            status: 1,
            branchCode: 'chery',
            branchName: '奇瑞',
            rowVersion: 'string'
        }
    });
});

router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});

router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

module.exports = router;
